package com.boxfishedu;

import org.springframework.mobile.device.Device;
import org.springframework.mobile.device.DeviceUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by lzx on 16/7/8.
 */
@RestController
public class DeviceDetectController {

    @RequestMapping(value = "/device/detect",method = RequestMethod.GET)
    public String detectDevice(HttpServletRequest request){
        Device device = DeviceUtils.getCurrentDevice(request);
        return device.getDevicePlatform().name();
    }
}
